// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2024 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.13.1
package sys

import (
	"context"
	"hotgo/api/admin/stockemotion"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	StockEmotion = cStockEmotion{}
)

type cStockEmotion struct{}

// List 查看市场情绪值列表
func (c *cStockEmotion) List(ctx context.Context, req *stockemotion.ListReq) (res *stockemotion.ListRes, err error) {
	list, totalCount, err := service.SysStockEmotion().List(ctx, &req.StockEmotionListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.StockEmotionListModel{}
	}

	res = new(stockemotion.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出市场情绪值列表
func (c *cStockEmotion) Export(ctx context.Context, req *stockemotion.ExportReq) (res *stockemotion.ExportRes, err error) {
	err = service.SysStockEmotion().Export(ctx, &req.StockEmotionListInp)
	return
}

// Edit 更新市场情绪值
func (c *cStockEmotion) Edit(ctx context.Context, req *stockemotion.EditReq) (res *stockemotion.EditRes, err error) {
	err = service.SysStockEmotion().Edit(ctx, &req.StockEmotionEditInp)
	return
}

// View 获取指定市场情绪值信息
func (c *cStockEmotion) View(ctx context.Context, req *stockemotion.ViewReq) (res *stockemotion.ViewRes, err error) {
	data, err := service.SysStockEmotion().View(ctx, &req.StockEmotionViewInp)
	if err != nil {
		return
	}

	res = new(stockemotion.ViewRes)
	res.StockEmotionViewModel = data
	return
}

// Delete 删除市场情绪值
func (c *cStockEmotion) Delete(ctx context.Context, req *stockemotion.DeleteReq) (res *stockemotion.DeleteRes, err error) {
	err = service.SysStockEmotion().Delete(ctx, &req.StockEmotionDeleteInp)
	return
}
